package com.aiyige.model.enums;

import com.aiyige.MyApp;
import com.aiyige.R;
import com.aiyige.model.Subject;

/**
 * Created by xiachao on 2017/11/22.
 */

public enum GoodsType {



 //    商品类型ID数组，类型：0-广告，1-图集，2-视频，3-资讯文章，4-专题，**5-教学视频，6-专业课程，7-培训班，8-私教，9-通用商品**，10-教室出租
    TYPE_PHOTO(Subject.photo, MyApp.getAppContext().getString(R.string.publish_photo)),
    TYPE_VIDEO(Subject.video,MyApp.getAppContext().getString(R.string.publish_video)),
    TYPE_ARTICLE(Subject.article,MyApp.getAppContext().getString(R.string.publish_info)),
    TYPE_SPECIAL_TOPIC(Subject.special_topic,MyApp.getAppContext().getString(R.string.publish_special_topic)),
    TYPE_VIDEO_COURSE(Subject.video_course,MyApp.getAppContext().getString(R.string.publish_learn_video)),
    TYPE_MAJOR_COURSE(Subject.major_course,MyApp.getAppContext().getString(R.string.major_course)),
    TYPE_TRAINING_COURSE(Subject.training_course,MyApp.getAppContext().getString(R.string.publish_training_class)),
    TYPE_TRAINING_CARD(Subject.training_card,MyApp.getAppContext().getString(R.string.training_card)),
    TYPE_PRIVATE_COURSE(Subject.private_course,MyApp.getAppContext().getString(R.string.publish_personal_trainer)),
    TYPE_COMMON_GOODS(Subject.common_goods,MyApp.getAppContext().getString(R.string.universal_product)),
    TYPE_DYNAMIC(Subject.dynamic,MyApp.getAppContext().getString(R.string.dynamic_display));

    public boolean isSelected() {
        return selected;
    }

    public void setSelected(boolean selected) {
        this.selected = selected;
    }

    private boolean selected;

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    private String type;
    private String value;
    GoodsType(String type, String value) {
        this.type = type;
        this.value = value;

    }


    /**
     * 根据key获取value
     *
     * @param key
     *            : 键值key
     * @return String
     */
    public static String getValueByKey(String key) {
        GoodsType[] enums = GoodsType.values();
        for (int i = 0; i < enums.length; i++) {
            if (enums[i].getType().equals(key)) {
                return enums[i].getValue();
            }
        }
        return "";
    }


}
